package com.yh.rent.dao.impl;

import java.util.List;

import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.Transaction;

import com.yh.rent.dao.TypeDao;
import com.yh.rent.entity.Type;
import com.yh.rent.utils.HibernateUtil;

public class TypeDaoImpl implements TypeDao {
	Session session = null;
	@Override
	public List<Type> getAllTypes() {
		session = HibernateUtil.getCurrentSession() ;
		Transaction ts = session.beginTransaction() ;
		Query query = session.createQuery("from Type") ;
		@SuppressWarnings("unchecked")
		List<Type>list = query.list() ;
		ts.commit();
		return list ;
		
	}

}
